nclude <iostream>
using namespace std;

typedef struct TNode{
        string data;
            struct TNode *leftchild,*rightchild;

}TNode,*Tree;

void createTree(Tree &T){
        char ch;
            cout << "输入节点信息:" << endl;
                cin >> ch;
                    if(ch == '#') T=NULL;
                    else{
                                T = new TNode;
                                        T->data = ch;
                                                cout<<"输入"<<ch<<"左子树"<<endl;
                                                        createTree(T->leftchild);
                                                                cout<<"输入"<<ch<<"右子树"<<endl;
                                                                        createTree(T->rightchild);
                                                                            
                    }   

}
void InOrderTraverse(Tree T){
    if(T){
                InOrderTraverse(T->leftchild);
                        cout<<T->data<<endl;
                                InOrderTraverse(T->rightchild);
                                    
    }

}
int NodeCount(Tree T){
        if(!T) return 0;
        else{
                    int count = NodeCount(T->leftchild)+NodeCount(T->rightchild)+1;
                            return count;
                                
        }

}
int main(){
        Tree T;
            createTree(T);
                InOrderTraverse(T);
                    cout << NodeCount(T) << endl;

}

